package com.example.service.impl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.entity.Employee;
import com.example.entity.Expenses;
import com.example.service.ExpensesService;
import com.example.service.LoanService;
import com.example.utils.TokenUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description TODO
 * @Author dingchunlin
 * @Date 2023/11/8 12:06
 * @Version 1.0.0
 */
@Service
public class LoanServiceImpl implements LoanService {

    @Autowired
    private ExpensesService expensesService;


    @Override
    public PageInfo<Expenses> selectPage(Expenses expenses, Integer pageNum, Integer pageSize) {
        //查询审核通过了的审批单
        expenses.setStatus("审核通过");
        PageHelper.startPage(pageNum, pageSize);
        List<Expenses> expensesList = expensesService.selectAll(expenses);
        return PageInfo.of(expensesList);
    }

    @Override
    public void updateStatus(Integer id) {
        //创建一个实体类
        Expenses expenses = new Expenses();
        expenses.setId(id);
        expenses.setStatus("已打款");
        expensesService.updateExpensesById(expenses);
    }
}
